﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _01c_InitializingMatrix
{
    class Program
    {
        static void PrintMatrix(int[,] matrix)
        {
            for (int row = 0; row < matrix.GetLength(0); row++)
            {
                for (int column = 0; column < matrix.GetLength(1); column++)
                {
                    Console.Write(matrix[row, column] + "\t");
                }
                Console.WriteLine();
            }
        }

        static void Main(string[] args)
        {
            int sizeOfMatrix = int.Parse(Console.ReadLine());
            int[,] theGreatMatrix = new int[sizeOfMatrix, sizeOfMatrix];

            int currentPosition = 1;

            for (int rows = sizeOfMatrix - 1; rows >= 0; rows--)
            {
                int currentNumberOfRow = rows;
                for (int column = 0; currentNumberOfRow < sizeOfMatrix; currentNumberOfRow++, column++)
                {
                    (theGreatMatrix[currentNumberOfRow, column]) = currentPosition++;
                }                
            }

            for (int columns = 1; columns < sizeOfMatrix; columns++)
            {
                int currentNumberOfColumn = columns;
                for (int row = 0; currentNumberOfColumn < sizeOfMatrix; currentNumberOfColumn++, row++)
                {
                    (theGreatMatrix[row, currentNumberOfColumn]) = currentPosition++;
                }
            }



            PrintMatrix(theGreatMatrix);

        }
    }
}
